package vy.org.app.page.lookup.delivery;

import org.vy.dal.dao.lookup.VyLookupDeliveryModeDO;

import vy.org.util.DateUtil;

public class MntnDeliveryModeAssembler {

	private static MntnDeliveryModeAssembler assembler = new MntnDeliveryModeAssembler();

	public static MntnDeliveryModeAssembler getAssembler() {
		return assembler;
	}

	public VyLookupDeliveryModeDO getdeDeliveryModeDO(MntnDeliveryModeForm form) {
		VyLookupDeliveryModeDO dto = new VyLookupDeliveryModeDO();

		if (form.getDeliveryModeCode() != null
				&& !"".equals(form.getDeliveryModeCode().trim())) {

			dto.setDeliveryModeCode(form.getDeliveryModeCode());
		}
		if (form.getDeliveryModeName() != null
				&& !"".equals(form.getDeliveryModeName().trim())) {

			dto.setDeliveryModeName(form.getDeliveryModeName());
		}
		if (form.getIsActive() != null && !"".equals(form.getIsActive().trim())) {

			dto.setIsActive(Boolean.parseBoolean(form.getIsActive()));
		}
		if (form.getLastUpdatedBy() != null
				&& !"".equals(form.getLastUpdatedBy().trim())) {

			dto.setLastUpdtBy(form.getLastUpdatedBy());
		}
		if (form.getLastUpdatedOn() != null
				&& !"".equals(form.getLastUpdatedOn().trim())) {

			dto.setLastUpdtOn(DateUtil.standardDate(form.getLastUpdatedOn()));
		}
		return dto;
	}
}
